#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
int main()
{
	cin >> arr[0];
	int count = 1;
	for (int i = 0; arr[i] != 0; i++) {
		cin >> arr[i+1];
		count++;
	}
	for (int i = count - 1 - 1; i >= 0; i--) {
		cout << arr[i] << " ";
	}
	return 0;
	/*int count = 0;
	for (int i = 0; i < 101; i++) {
		cin >> arr[i];
		if (arr[i] != 0) {
			count++;
		}
		else {
			break;
		}
	}
	for (int i = count - 1; i >= 0; i--) {
		cout << arr[i] << " ";
	}
	return 0;*/
}